/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controllers;


import DAO.EventDAO;
import java.util.List;
import java.util.Map;
import model.EventBean;
import model.SearchBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 *
 * @author lg
 */

@Controller
@RequestMapping("/searchevent.htm")
public class SearchEventController {
    
    @RequestMapping( method = RequestMethod.GET )
    public String searchEvents(Map model){
        return "searchevent";
    }
    
    @RequestMapping ( method = RequestMethod.POST)
    public String searchEvents(Map model,SearchBean searchBean){
        EventDAO eventDAO = new EventDAO();
        List<EventBean> eventBeans = eventDAO.searchEvents(searchBean);
        model.put("events", eventBeans);
        return "searcheventresult";
    }
}
